/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package instantmessengercpsc360.client;

import java.util.ArrayList;
import java.util.EventObject;

/**
 *
 * @author nicholas
 */
public class ClientListUpdateEvent extends EventObject {
    public ClientListUpdateEvent(ServerLiaison source, ArrayList<String> clients)
    {
        super(source);
        this.addedClients = new ArrayList<String>(clients);
        type = ADD_LIST;
    }
    public ClientListUpdateEvent(ServerLiaison source, String client, Boolean add)
    {
        super(source);
        if (add)
        {
            addedClient = client;
            type = ADD;
        }
        else
        {
            deletedClient = client;
            type = DEL;
        }
    }
    
    protected ArrayList<String> addedClients;
    protected String addedClient;
    protected String deletedClient;
    protected int type;
    
    //type of event
    public static int ADD_LIST = 0;
    public static int ADD = 1;
    public static int DEL = 2;
    
    
    @Override
    public ServerLiaison getSource()
    {
        return (ServerLiaison)source;
    }
    
    public ArrayList<String> getAdds()
    {
        return new ArrayList<String>(addedClients);
    }
    
    public String getAddClient()
    {
        return addedClient;
    }
    
    public String getDelClient()
    {
        return deletedClient;
    }
    
    public int getType()
    {
        return type;
    }
}
